var mapIds = [924030005, 924030100];
var 准备地图 = 240090000;

function init() {}

function setup(c, a) {
    em.setProperty("state", 1);
    em.setProperty("leader", "true");
    var c = em.newInstance("岩壁巨人_上山之路");
    for (var b = 0; b < mapIds.length; b++) {
        var d = c.setInstanceMap(mapIds[b]);
        d.resetFully();
        d.killAllMonsters(false)
    }
    return c
}

function onPlayerRegistered(b, a) {
    a.setReviveCount(-100);
    var c = b.getMapInstance(0);
    a.changeMap(c, c.getPortal(0))
}

function onPlayerRevived(b, a) {
    return false
}

function onMapChanged(f, e, d) {
    if (mapIds.indexOf(d) < 0) {
        on玩家退场(f, e, false);
        return
    }
    if (d == 924030100) {
        e.scheduleOpenNpcTask(120, 0, "岩壁巨人_上山之路_通关");
        e.getAPI().岩壁巨人_上山之路_开始();
        e.getAPI().setNumberForQuestInfo(31339, "hp", 100);
        e.getAPI().curNodeEventEnd(true);
        e.getAPI().fieldEffect_Clear("defense/count");
        e.getAPI().fieldEffect_Clear("kite/start");
        e.getAPI().onActionBarResult(6, 0);
        e.getAPI().onActionBarResult(5, 0);
        var b = [
            [9307000, 9307001, 9307002],
            [9307003, 9307004, 9307005]
        ];
        for (var c = 3; c <= 123; c += 1) {
            if (e.getAPI().rand(1, c <= 60 ? 3 : 2) == 1) {
                var a = c <= 60 ? 0 : 1;
                var g = e.getAPI().rand(b[a]);
                var h = g == 9307000 || g == 9307003 ? 200 : 275;
                e.getAPI().spawnMobSchedule(g, 1, 1529, h, c * 1000)
            }
        }
    }
    em.setProperty("kill", "0");
    em.setProperty("clear", "0");
    em.setProperty("curMap", d)
}

function onPlayerDisconnected(b, a) {
    on玩家退场(b, a, false);
    return 0
}

function onTimeOut(a) {
    a.getPlayers().forEach(function (b) {
        on玩家退场(a, b, true)
    })
}

function onMonsterKilled(a, b) {
    return 1
}

function onPlayerRevived(b, a) {
    return false
}

function onPartyDisbanded(a) {}

function onPlayerKilled(b, a) {}

function randomNum(b, a) {
    switch (arguments.length) {
        case 1:
            return parseInt(Math.random() * b + 1, 10);
            break;
        case 2:
            return parseInt(Math.random() * (a - b + 1) + b, 10);
            break;
        default:
            return 0;
            break
    }
}

function initProp(a, b) {
    if (em.getProperty(a) == null) {
        em.setProperty(a, b)
    }
}

function initPropArray(a, d, c, e) {
    for (var b = c; b <= e; b++) {
        if (em.getProperty(a + "_" + b) == null) {
            em.setProperty(a + "_" + b, d)
        }
    }
}

function on玩家退场(c, b, a) {
    b.getAPI().dispelBuff(80001277);
    c.disposeIfPlayerBelow(a ? 999 : 0, 准备地图);
    em.getProperties().clear();
    em.setProperty("state", 0);
    em.setProperty("leader", "true");
    c.unregisterPlayer(b)
};